#include <iostream>

using namespace std;

typedef long long LL;

LL a, b, c; int k;
int T;

int main()
{
	cin >> T;
	while(T--)
	{
		cin >> a >> b >> c >> k;
		while(k--)
		{
			LL na = (b + c) >> 1;
			LL nb = (a + c) >> 1;
			LL nc = (a + b) >> 1;
			a = na; b = nb; c = nc;	
			if(a == b && b == c) break;
		}	
		cout << a << " " << b << " " << c << endl;
	} 
	return 0;
}
